<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // opacity:0.5;
        var str = 'filter:alpha(opacity=10)';// IE678;
        // 字面量方式
        // var reg = /filter:alpha\(opacity=(\d+)\)/;

        // 构造函数模式： 转义符都需要双杠
        var reg = new RegExp('filter:alpha\\(opacity=(\\d+)\\)');
        var result = str.match(reg);
        console.log(result);
    </script>
</body>
</html>